
public class PreOderTraverse {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Tree r = new Tree(1);
		r.lchild = new Tree(2);
		r.rchild = new Tree(3);
		preOder(r);
	}
	
	public static void preOder(Tree t) {
		if(t != null){
			preOder(t.lchild);
			System.out.println(t.data);
			preOder(t.rchild);
		}
	}
}
class Tree {
	int data;
	Tree lchild;
	Tree rchild;
	public Tree(int d){
		data = d;
	}
}